package cursojava.io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;

import cursojava.bean.Transformer;

public class ExampleIOSerializable {
		
	public void saveObject() throws IOException{
		
		
		
		
		Transformer optimus = new Transformer("Optimus","100",new String[]{"Espada Laser","Misiles M5000"});
		Transformer megatron = new Transformer("Megatron","100",new String[]{"Espada Energon","Cannon Laser"});
		Transformer bumblebee = new Transformer("Bumblebee","70",new String[]{"Pistola Laser"});
		Transformer starscream = new Transformer("Starscream","80",new String[]{"Misiles M4000","Pistola Laser"});
		
		
		
		
	}

	
	public List<Transformer> readData() throws IOException, Exception{
		List<Transformer> lista = new ArrayList<Transformer>();
		
		
		
		Transformer transformer1 = null;
		Transformer transformer2 = null;
		Transformer transformer3 = null;
		Transformer transformer4 = null;
		
		lista.add(transformer1);
		lista.add(transformer2);
		lista.add(transformer3);
		lista.add(transformer4);
		
		
		return lista;
	}

	public static void main(String[] args) throws Exception {

		ExampleIOSerializable exampleIO = new ExampleIOSerializable();
		exampleIO.saveObject();
		List<Transformer> lista = exampleIO.readData();
		
		for (int i = 0; i < lista.size(); i++) {
			Transformer t = lista.get(i);
		
			System.out.println(t.getName() + " , " + t.getWeapons()[0]);
		}
		

	}
	
	/**
	 * 
	 	List<Transformer> listaGanadores = new ArrayList<Transformer>();
		Transformer ganador1 = pelea(new Transformer("100","Optimus"),new Transformer("100","Megatron"));
		Transformer ganador2 = pelea(new Transformer("70","Bumblebee"),new Transformer("80","Starscream "));
		listaGanadores.add(ganador1);
		listaGanadores.add(ganador2);
		
	 */
}
